/*  
 *  Copyright 2006 Paul Jack.
 *
 *  This file is part of the Dex compiler suite. 
 *  
 *  Dex is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License as published by the
 *  Free Software Foundation; either version 2 of the License, or (at your
 *  option) any later version.
 *  
 *  Dex is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 *  Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 */
package dex.test;


import dex.compiler.model.definition.Unit;


class TemplateCase extends SingleTest {


	final private TemplateSuite suite;
	final private String code;
	final private String replacement;
	final private String location;
	final private String expected;


	public TemplateCase(TemplateSuite suite, String location, String code, String replacement, String expected) {
		super(replacement);
		this.suite = suite;
		this.location = location;
		this.code = code;
		this.replacement = replacement;
		this.expected = expected;
	}
	
	
	@Override
	protected void doTest() throws Exception {
		String c = code.replace("TEMPLATE", replacement);
		Unit unit = suite.getProgram().add(location, c);
		suite.doTest(unit, expected);
		// FIXME: remove unit from program
	}


}
